<template>
  <div class="content">
    <avue-form
      ref="form"
      v-model="obj"
      :option="option"
      @reset-change="emptytChange"
      @submit="submit"
    >
    </avue-form>
  </div>
</template>

<script>
import { uploadUrl, post } from "@/api/base.js";
export default {
  name: "member",
  data() {
    return {
      obj: {
        users: [],
        is_all: false,
        title: "",
        sub_title: "",
        content: "",
      },
      option: {
        submitText: "发送",
        column: [
          {
            label: "用户",
            prop: "users",
            dicUrl: "/option/member?key={{key}}",
            dicMethod: "get",
            remote: true,
            multiple: true,
            props: {
              label: "label",
              value: "value",
            },
            type: "select",
            span: 24,
          },
          {
            label: "标题",
            prop: "title",
            span: 24,
          },
          {
            label: "副标题",
            prop: "sub_title",
            span: 24,
          },
          {
            label: "全部人员",
            prop: "is_all",
            type: "switch",
            value: false,
            span: 24,
          },
          {
            label: "内容",
            span: 24,
            options: {
              action: uploadUrl(),
            },
            type: "ueditor",
            prop: "content",
          },
        ],
      },
    };
  },
  methods: {
    emptytChange() {
      this.obj = {
        users: [],
        is_all: false,
        title: "",
        sub_title: "",
        content: "",
      };
    },
    submit(form, done) {
      post("send/sys-notify", form)
        .then((res) => {
          // console.log(res);
          this.$message.success("发送成功");
          done();
        })
        .catch((err) => {
          console.log(err);
          done();
        });
    },
  },
};
</script>

<style lang="scss" scoped>
.content {
  margin: 10px;
  padding: 10px;
}
</style>

